package com.szgr.baoyin.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;

import com.android.volley.toolbox.ImageLoader;
import com.szgr.baoyin.MyApplication;
import com.szgr.baoyin.R;
import com.szgr.baoyin.adapter.OrderListAdapter;

/**
 * 服务站展示页面
 */
public class OrderActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_order);
        super.onCreate(savedInstanceState);
    }

    @Override
    public void initActionBar() {
        actionBarTitle.setText("保银1号服务站");
    }

    @Override
    public void initView() {
        Button orderButton = (Button) findViewById(R.id.order_now);
        orderButton.setOnClickListener(this);
        ListView orderListView = (ListView) findViewById(R.id.order_list_view);
        OrderListAdapter orderAdapter = new OrderListAdapter(this);
        orderListView.setAdapter(orderAdapter);
        ImageView topImage = (ImageView) findViewById(R.id.order_top);
        ImageLoader.ImageListener listener = ImageLoader.getImageListener(topImage,R.drawable.home_page,R.drawable.home_page);
        MyApplication.getmInstance().getImageLoader().get("http://www.365zhuti.com/wall/UploadPic/2012-4/365zhuti_20120418095954_0.jpg", listener);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.action_bar_left:
                finish();
                break;
            case R.id.order_now:
                Intent orderIntent = new Intent(this,OrderDetailActivity.class);
                startActivity(orderIntent);
                break;
        }
    }
}
